package com.project.controller;

import com.project.util.UploadUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.time.LocalDate;

@RestController
@RequestMapping("test")
public class TestController {

    @RequestMapping("info")
    public String getInfo(){
        return "hello，世界";
    }

    @RequestMapping("add")
    public String add(LocalDate startDate, LocalDate endDate,
                      Integer startPrice, Integer endPrice,
                      @RequestParam("face") MultipartFile mf){
        String fileName =  UploadUtil.upload(mf, "META-INF/resources/upload");
        return startDate+"    "+endDate+"    "+startPrice+"    "+endPrice+"   "+fileName;
    }
}
